<template>
	 <view style="display: flex; background-color:azure; border-radius: 15px; padding: 10px;margin: 10px; font-weight: 600;">
	 	<view class="weaItem">您所在的城市：{{city}},</view>
	 	<view class="weaItem">今日最{{highWendu}}</view>
	 	<view class="weaItem">今日最{{lowWendu}}</view>
	 </view>
	 	 
	 <view style="display: flex; background-color:azure; border-radius: 15px; padding: 10px;margin: 10px; font-weight: 600;">
	 	今天记得：{{notice}}
	 </view>
		
	 
	<view v-for="item in dataObj" style="margin: 10px;">
		
		<NewsCardText 
		:title="item.title" 
		:isTop="item.isTop" 
		:count="item.conut" 
		:author="item.author"
		:time="item.time"
		:images="item.images"
		:isOneImg="item.isOneImg"
		:isguang="item.isguang">
		
		   <template v-slot:search-container v-if="item.isSearch" >
		     	<view>
				
				     <text style="color: chocolate;"> 今日金价 </text>
				
			    </view>
		   </template>
		
		
        </NewsCardText>
		
	</view>
</template>

<script>
	import NewsCardText from '../../../components/NewsCardText.vue'
	export default {
		data() {
			return {
				city:'无',
				highWendu:'无',
				lowWendu:'无',
				notice:'无',
				
				dataObj: [{
						title: '第一观察 | 锚定目标 团结奋进',
						isTop: true,
						author: '新华社',
						conut: '465万',
						time: '2025-10-28'
					},
					{
						title: '00后用家用打印机造250多万假币，警方：通过境外软件学习造假技术',
						isTop: true,
						author: '腾讯',
						conut: '45万',
						time: '2025-10-23',
						images:[
							'/static/city2.jpg',
							'/static/city3.jpg',
							'/static/city4.jpg',
						]
					},
					{
						title: '回首向来萧瑟处，归去，也无风雨也无情。',
						isTop: true,
						author: '百度',
						conut: '99999万',
						time: '2025-10-25',
						images:[
							'/static/city2.jpg',
							'/static/city3.jpg',
						]
					},
					{
						title: '全国体育系统先进个人拟表彰对象公布，樊振东、全红婵等在列',
						isTop: true,
						author: '新浪体育',
						conut: '654万',
						time: '2025-10-28',
						isOneImg: [
							'/static/city3.jpg',
						]
					},
					{
						title: '特朗普谈2028大选：愿再参选，点名鲁比奥、万斯为候选人含税单价佛挡杀佛旷达科技刚发很大设计开发高级卡法刷卡备受打击粉红色规范化',
						isTop: true,
						author: '观察者网',
						conut: '6666万',
						time: '2025-10-28',
						isSearch: true,
						isOneImg: [
							'/static/city3.jp',
						]
					},
					{
						title: '这就是我们的库里，只手能日天的库里',
						isTop: false,
						isguang:true,
						author: '小陈爱看球',
						conut: '465万',
						time: '2025-10-28'
					},
				]
			}
		},
		
		
		onLoad() {
			this.getWeather()
		},
		
		onShow(){
			this.getWeather()
		},
		
		methods: {
            getWeather() {
				console.log(45687);
            	uni.request({	
            		url: 'http://t.weather.sojson.com/api/weather/city/101230501',
            		method: 'GET',
					// header: {
						 
					// 	'Content-Type': 'application/x-www-form-urlencoded'
					// },
            		 
            		 
            		success: (res) => {
						console.log(res);
            			console.log('查询结果', res.data.message);
            
            			 
						this.city = res.data.cityInfo.city
						this.highWendu = res.data.data.forecast[0].high
						this.lowWendu = res.data.data.forecast[0].low
						this.notice = res.data.data.forecast[0].notice            		},
            		fail: (err) => {
            			 console.log('获取信息失败');
            		},
            		
            	})
			  }	
            
		},

		components: {
			NewsCardText,
		}
	}
</script>

<style>
.weaItem{
	margin-right: 20rpx;
}
</style>